package com.chenshu.springboot_demo.config.controller;

import com.chenshu.springboot_demo.config.model.DBTypes;
import com.chenshu.springboot_demo.config.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2024-04-05
 * Time：21:14
 */
@RestController
public class TestController {

    @Value("${mykey.key1}")
    private String myKey1;

    @Value("${mykey.key2}")
    private String myKey2;

    @Value("${mykey.key3}")
    private String myKey3;

    @Autowired
    private User user;

    @Autowired
    private DBTypes dbTypes;

    //配置路由
    @RequestMapping("/getkey")
    public void getMyKey() {
        System.out.println(myKey1);
        System.out.println(myKey2);
        System.out.println(myKey3);
    }

    @RequestMapping("/getuser")
    public String getUser() {
        return "Hi, " + user;
    }

    @RequestMapping("/getdb")
    public String getDBTypes() {
        return "Hi, " + dbTypes;
    }
}
